home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.metal;
-
- import com.sun.java.swing.AbstractButton;
- import com.sun.java.swing.ButtonModel;
- import com.sun.java.swing.Icon;
- import com.sun.java.swing.JComponent;
- import com.sun.java.swing.SwingUtilities;
- import com.sun.java.swing.UIManager;
- import com.sun.java.swing.plaf.ComponentUI;
- import com.sun.java.swing.plaf.basic.BasicGraphicsUtils;
- import com.sun.java.swing.plaf.basic.BasicRadioButtonUI;
- import com.sun.java.swing.plaf.basic.BasicToggleButtonUI;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Rectangle;
-
- public class MetalRadioButtonUI extends BasicRadioButtonUI {
- private static final MetalRadioButtonUI metalRadioButtonUI = new MetalRadioButtonUI();
- protected ButtonModel model;
- // $FF: renamed from: f java.awt.Font
- Font field_0;
- // $FF: renamed from: fm java.awt.FontMetrics
- FontMetrics field_1;
- Rectangle viewRect;
- Rectangle iconRect;
- Rectangle textRect;
- Icon altIcon;
- Icon selectedIcon;
- Icon disabledIcon;
-
- public static ComponentUI createUI(JComponent c) {
- return metalRadioButtonUI;
- }
-
- public synchronized void paint(Graphics g, JComponent c) {
- AbstractButton b = (AbstractButton)c;
- this.model = b.getModel();
- Dimension size = ((Component)c).getSize();
- int var10000 = size.width;
- var10000 = size.height;
- this.field_0 = ((Component)c).getFont();
- g.setFont(this.field_0);
- this.field_1 = g.getFontMetrics();
- this.viewRect = new Rectangle(size);
- this.iconRect = new Rectangle();
- this.textRect = new Rectangle();
- this.altIcon = b.getIcon();
- this.selectedIcon = null;
- this.disabledIcon = null;
- String text = SwingUtilities.layoutCompoundLabel(this.field_1, b.getText(), this.altIcon != null ? this.altIcon : super.icon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), this.viewRect, this.iconRect, this.textRect, ((BasicToggleButtonUI)this).getDefaultTextIconGap(b));
- if (c.isOpaque()) {
- g.setColor(((Component)b).getBackground());
- g.fillRect(0, 0, size.width, size.height);
- }
-
- if (this.altIcon != null) {
- if (!this.model.isEnabled()) {
- this.altIcon = b.getDisabledIcon();
- } else if (this.model.isPressed() && this.model.isArmed()) {
- this.altIcon = b.getPressedIcon();
- if (this.altIcon == null) {
- this.altIcon = b.getSelectedIcon();
- }
- } else if (this.model.isSelected()) {
- this.altIcon = b.getSelectedIcon();
- } else if (b.isRolloverEnabled() && this.model.isRollover()) {
- this.altIcon = b.getRolloverIcon();
- }
-
- if (this.altIcon == null) {
- this.altIcon = b.getIcon();
- }
-
- this.altIcon.paintIcon(c, g, this.iconRect.x, this.iconRect.y);
- } else {
- super.icon.paintIcon(c, g, this.iconRect.x, this.iconRect.y);
- }
-
- if (text != null) {
- if (this.model.isEnabled()) {
- g.setColor(((Component)b).getForeground());
- BasicGraphicsUtils.drawString(g, text, this.model.getMnemonic(), this.textRect.x, this.textRect.y + this.field_1.getAscent());
- } else {
- g.setColor(((Component)b).getBackground().darker());
- BasicGraphicsUtils.drawString(g, text, this.model.getMnemonic(), this.textRect.x, this.textRect.y + this.field_1.getAscent());
- }
-
- if (((JComponent)b).hasFocus() && b.isFocusPainted() && this.textRect.width > 0 && this.textRect.height > 0) {
- this.paintFocus(g, this.textRect, size);
- }
- }
-
- }
-
- protected void paintFocus(Graphics g, Rectangle t, Dimension d) {
- g.setColor(UIManager.getColor("RadioButton.focus"));
- g.drawRect(t.x, t.y - 1, t.width + 1, t.height + 1);
- }
- }
-